{if isset($presItem)}
	<input type="hidden" id="printPrescription" value='{$recordId}'>
{else}
	<input type="hidden" id="printPrescription" value=''>
{/if}
<div id="maincontainer2" align='center' >
<table cellspacing="0" cellpadding="0" class='printDetails' style='width: 500px; padding-top: 8px;'>
    <tr>
    	<td class="field" style="text-align: left;">{translate}Full name{/translate}: <span style='font-size: 1.1em; text-transform: uppercase'><b>{$person->getName()}</b></span></td>
        <td style="text-align: right;" class="field">{translate}Patient's ID{/translate}: <span style='font-size: 1.1em'><b>{$patient->getPatientCode()}</b></span></td>
    </tr>
    <tr>
        <td class="field" style="text-align: left;">{translate}Gender{/translate}: {if $person->getGender()=="male" } {translate}Male{/translate} {elseif $person->getGender()=="female"} {translate}Female{/translate} {/if}</td>
        <td style="text-align: right;" class="field">{translate}Date of birth{/translate}: {$person->getDateofBirth()} ({translate}Age{/translate}: {$person->getAge()})</td>
    </tr>
     <tr>
        <td colspan='2' class="field" style="text-align: left;">{translate}Address{/translate}: {$person->getAddress()}</td>
    </tr>
</table>
<br />
{if isset($presItem)}
	<table cellspacing='0' cellpadding='0' class='printGrid' style="margin-top: 5px; margin-bottom: 5px;">
		<tr>
			<td width='90px' valign='top' style='border: none; text-align: left;'>
				<b><u>{translate}Diagnosis{/translate}:</u></b>
			</td>
			<td width='400px' valign='top' style='border: none; font-weight: bold; font-size: 1.2em; font-style: italic; text-align: left;'>
				{$diagnosis->getChanDoan()|nl2br}			
			</td>
		</tr>
	</table>
	<table cellspacing='0' cellpadding='0' class='printGrid'>
		{foreach from=$presItem item=item}
		{if !empty($item.medicine_name)}
		<tr>
			<td valign='top' width='20px' style='padding-top: 7px; padding-bottom: 0px; border: none; text-align: left;'><span style='font-weight: bold; font-size: 1.2em'>{$i++}/. </span></td>
			<td valign='top' width='410px' style='padding-left: 5px; padding-top: 7px; padding-bottom: 0px; border: none; border-bottom: 1px dotted #000;text-align: left;'>
				<span style='font-weight: bold; font-size: 1.2em'>
				{php}
				$prescriptionItem = $this->get_template_vars('item');
				if (strpos(strtolower($prescriptionItem['usage_title']), L10nHelper::_('ins')) !== false) {
					echo "<i>Collyre. </i>";
				} elseif (strpos(strtolower($prescriptionItem['usage_title']), L10nHelper::_('app')) !== false) {
					echo "<i>Pde. </i>";
				}
				{/php}
					{$item.medicine_name|capitalize_first}
				</span>
			</td>
			<td valign='top' width='70px' style='text-align: right; padding-top: 7px; padding-bottom: 0px; border: none; border-bottom: 1px dotted #000;text-align: left;'>
				<span style='font-size: 1.2em; font-weight: bold'>{$item.quantity_num} {$item.quantity_title}</span>
			</td>
		</tr>
		<tr>
			<td></td>
			<td colspan='2' style='border: none; padding-top: 4px; padding-bottom: 1px; text-align: left;'>
				<span><b>{$item.usage_title|capitalize_first}</b> {translate p1=$item.usage_num p2=$item.usage_unit p3=$item.dosage p4=$item.time}each time %s %s day %s time, in %s day(s){/translate}</span>
			</td>
		</tr>
		{if $item.note != ''}
		<tr>
			<td></td>
			<td colspan='2' style='border: none; padding-top: 4px; padding-bottom: 1px; text-align: left;'>
				<span>{$item.note}</span>
			</td>
		</tr>
		{/if}
		{/if}
		{/foreach}		
	</table>
	<table cellspacing='0' cellpadding='3' style="margin-top: 8px; margin-bottom: 8px;width: 500px;">
		<tr style="width: 100%;">
			<td style="width: 80px; text-align: left;">
				<b><u>{translate}Advices{/translate}:</u></b>
			</td>
			<td style="text-align: left;">
				{$info.note|nl2br}			
			</td>
		</tr>
		<tr style="width: 100%;">
			<td style="width: 80px; text-align: left;">
				<b><u>{translate}Re-examination{/translate}:</u></b>			
			</td>
			<td style="text-align: left;">
				{$info.re_examine}			
			</td>
		</tr>
	</table>
	<table cellspacing='0' cellpadding='0'">
		<tr style="width: 100%;">
			<td style="width: 300px;">&nbsp;</td>
			<td style='text-align: right; padding: 5px 5px 5px 5px;'>
				<div style="text-align: center;">
					<span>{translate}{/translate} {$info.date}</span><br/>
					<span>{translate}Attending physician{/translate}</span><br/>
					<span>{$info.name}</span>
				</div>
			</td>
		</tr>
	</table>
	<input id='empty' name='empty' type='hidden' value='0'/>
{else}
	<input id='empty' type='hidden' value='1'/>
	<span class='label'>{translate}PATIENT DOES NOT HAVE A PRESCRIPTION YET{/translate}</span><br/><br/>
{/if}
</div>